package com.jh.paymentchannel.qctpos.eumn;

import org.apache.commons.lang.StringUtils;

public enum QctposBaseEnum {
    SUCCESS("00000", "请求成功"),
    SERVICE_ERROR("20000", "服务不可用"),
    AUTH_ERROR("20001", "商户无此接口权限"),
    BUSINESS_ERROR("40004", "业务处理失败"),
    SIGN_ERROR("40005", "签名解析失败"),
    SERVER_ERROR("50000", "服务器内部错误"),
    TIME_OUT_ERROR("50005", "系统超时");

    QctposBaseEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private String value;

    private String desc;


    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(String value) {
        if (StringUtils.isBlank(value)) return "";
        QctposBaseEnum[] qctposBaseEnums = QctposBaseEnum.values();
        for (QctposBaseEnum qctposBaseEnum : qctposBaseEnums) {
            if (qctposBaseEnum.getValue().equals(value)) {
                return qctposBaseEnum.getDesc();
            }
        }
        return "";
    }
}
